package plug.PenduPlugin;

import java.util.ArrayList;

import javax.swing.JPanel;

import plug.Introspection;

import Controller.MainController;
import Factories.FactoryDAO;
import Model.Correction;
import Model.Enonce;
import Model.Exercice;
import Model.Professeur;
import Model.Resultat;

public class Pendu extends Exercice {

	@Override
	public double noter(Resultat r) {
		return 0;
	}

	@Override
	public int countError(Resultat r) {
		return 0;
	}

	@Override
	public JPanel getPanelEtud() {
		return null;
	}

	@Override
	public JPanel getPanelProf() {
		return new PenduPanelProf();
	}

	@Override
	public ArrayList<Exercice> lister() {
		return null;
	}

	@Override
	public void corriger(Resultat r) {
		r.creer();
	}

	@Override
	public void editer() {}

	@Override
	public JPanel consulter() {
		return new PenduPanelProf();
	}

	@Override
	public void validerReponse(String rep) {}

	@Override
	public int countCorrect() {
		return 0;
	}

	@Override
	public void ajoutEnonce(Enonce e) {}

	@Override
	public void ajoutCorrection(Correction e) {}

	@Override
	public void supprimeEx() {}

	@Override
	public void construct(String nomExercice, Professeur pr) {

		this.exdao = FactoryDAO.getInstance(null).createExerciceDAO();
		type = nomExercice;
		auteur = pr.getIdCompte();
		nomPlugIn = exdao.nomPlugIn(nomExercice);

	}

	public void creer(String reponse) {
		Enonce e = new Enonce("Trouvez le mot myst\u00E8re");
		Correction co = new Correction(reponse);
		this.setEnonce(e);
		this.setCorrection(co);
		this.exdao.create(this);

	}

	@Override
	public JPanel getPanel(MainController control) {
		return new Introspection(control,this);
	}

	@Override
	public JPanel getRempliPanel(MainController control) {
		return new PenduPanelEtud(control,this);
	}

	@Override
	public void creer() {}

}

